app.controller("baseController",function($scope)
{
	
	
	
	//分页控件配置 
	$scope.paginationConf = {
			 currentPage: 1,
			 totalItems: 10,
			 itemsPerPage: 10,
			 perPageOptions: [10, 20, 30, 40, 50],
			 onChange: function(){
			        	//重新加载
			        $scope.reloadList();	
			 }
	}; 
	$scope.reloadList = function()
	{
		$scope.search($scope.paginationConf.currentPage , $scope.paginationConf.itemsPerPage);
	}
	
//更新复选框	
	$scope.selectIds =[]; //用户勾选的id集合
	
	$scope.updateSelection = function($event,id)
	{
		if($event.target.checked)
			{
			$scope.selectIds.push(id);
			}
		else
			{
			var index = $scope.selectIds.indexOf(id);
			$scope.selectIds.splice(index,1);//参数1：移除的位置，参数2：移除的个数
			}
		
	}
//初始化查询	
	$scope.searchEntity ={}; //初始化不然查询为400
	
	//选择下拉框显示值
	$scope.jsonToString = function(jsonString,key)
	{
		var json = JSON.parse(jsonString);
		
		var value ="";
		for(var i=0;i<json.length;i++)
			{
				if(i>0)
					{
					value+=",";
					}
					
			
				value+=json[i][key]
			
			}
		
		return value;
	}
	
});

